home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group97b.txt / 000003_icon-group-sender _Fri Jun 27 06:01:27 1997.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Fri, 27 Jun 1997 08:25:58 MST
  2. Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM)
  3.     id AA18317; Fri, 27 Jun 1997 08:25:57 -0700
  4. Posted-Date: Fri, 27 Jun 1997 06:01:27 -0500 (CDT)
  5. Date: Fri, 27 Jun 1997 06:01:27 -0500 (CDT)
  6. From: Chris Tenaglia <cdt@post.its.mcw.edu>
  7. To: Lane Wimberley <lane@mcc.com>
  8. Cc: icon-group@cs.arizona.edu
  9. Subject: Re: Process ID availability?
  10. In-Reply-To: <33B16186.1EA6@mcc.com>
  11. Message-Id: <Pine.SOL.3.96.970627055343.26938A-100000@post.its.mcw.edu>
  12. Mime-Version: 1.0
  13. Content-Type: TEXT/PLAIN; charset=US-ASCII
  14. Errors-To: icon-group-errors@cs.arizona.edu
  15. Status: RO
  16.  
  17.  
  18. The following code seg will return the pid.
  19. It assumes that you are running solaris unix
  20. and that you aren't running other icon programs
  21. in the same session. But it's probably adequate
  22. for most applications.
  23.  
  24. procedure getpid()
  25.   pipe := open("ps -f","pr")
  26.   every line := !pipe do
  27.     if find("iconx",line) then
  28.       pid := parse(line,' ')[2]
  29.   close(pipe)
  30.   return pid
  31.   end
  32.  
  33. procedure parse(line,delims)
  34.   static chars
  35.   chars  := &cset -- delims
  36.   tokens := []
  37.   line ? while tab(upto(chars)) do put(tokens,tab(many(chars)))
  38.   return tokens
  39.   end
  40.  
  41.  
  42. Chris Tenaglia   (system manager)     |  The future foretold,
  43. Medical College of Wisconsin          |  The past explained,
  44. 8701 W. Watertown Plank Rd.           |  The present largely appologized for.
  45. Milwaukee, WI 53226   (414)456-8765   |  Organon to the Doctor
  46.  
  47.  
  48. On Wed, 25 Jun 1997, Lane Wimberley wrote:
  49.  
  50. > Date: Wed, 25 Jun 1997 18:20:55 GMT
  51. > From: Lane Wimberley <lane@mcc.com>
  52. > To: icon-group@cs.arizona.edu
  53. > Subject: Process ID availability?
  54. > Is there a way to determine process ID in Icon?  (... a la
  55. > getpid() in C)
  56. > -- 
  57. > Lane Wimberley
  58. > Microelectronics and Computer Technology Corporation
  59. > Austin, TX
  60.  
  61.